﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using iMapa.UI.ModelView.Main;
using System.Collections.ObjectModel;
using iMapa.Backend;
using iMapa.UI.ModelView.Editor;

namespace iMapa.UI.View.Editor
{
    /// <summary>
    /// Interaction logic for EditorToolbar.xaml
    /// </summary>
    public partial class EditorToolbar : UserControl
    {
        public EditorToolbar()
        {
            InitializeComponent();
        }

        private void simul_Click(object sender, RoutedEventArgs e)
        {
            MapViewModel model = (MapViewModel)this.DataContext;
            InteractMapLoader.Save(model.Imap);
            GroupViewModel gmv=new GroupViewModel(model.Root);
            gmv.Igroup = new InteractMapGroup();
            gmv.Igroup.Maps = new List<InteractMap>();
            gmv.Igroup.Maps.Add(model.Imap);
            gmv.Maps= new ObservableCollection<MapViewModel>();
            gmv.Maps.Add(model);
            model.Root.CurrentViewObject = gmv; 
        }

        private void addPoint_Click(object sender, RoutedEventArgs e)
        {
            MapViewModel model = (MapViewModel)this.DataContext;
            InteractObjectViewModel obj=  model.AddPoint();
            obj.Parent.SelectedIObj = obj;   
        }

    }
}
